package com.newmacys.bag;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.context.ApplicationContext;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.BaseCommandController;

public class ViewBagController extends BaseCommandController {

	public BagBean bagBean;
	
	protected ModelAndView handleRequestInternal(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		Map<String, Object> model = new HashMap<String, Object>();
		
		model.put("props", bagBean);
		request.setAttribute("props", bagBean);
		
		ApplicationContext app = getApplicationContext();
		
		return new ModelAndView(bagBean.getTilesView(), model);
	}

	public void setBagBean(BagBean userConfigBean) {
		this.bagBean = userConfigBean;
	}

}
